package microgame.airplane.proto;

public class ProtoPacker {
    public static byte[] PackMessage(int id, byte[] content) {
        byte[] result = new byte[content.length + 6];

        result[0] = (byte) ((content.length & 0xFF00) >> 8);
        result[1] = (byte) (content.length & 0xFF);

        result[2] = (byte) ((id & 0xFF00) >> 8);
        result[3] = (byte) (id & 0xFF);

        result[4] = 0;
        result[5] = 0;

        System.arraycopy(content, 0, result, 6, content.length);

        return result;
    }
}
